
<%--
  Created by IntelliJ IDEA.
  User: 宇
  Date: 2023/8/7
  Time: 18:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java"  isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="path" value="${pageContext.request.contextPath }"/>
<html>
<head>
    <script src="${path}/js/jquery-3.6.4.js"></script>
    <title>影院列表</title>
<%--    <link  rel="stylesheet" href="${path}/css/zxyCss/ciemList.css">--%>
    <style>
        *{
            margin: 0px;
            padding: 0px;

        }
        .a101{
            width: 1200px;
            height: 1200px;
            border: 1px solid black;
        }

        img{
            width: 40px;
            height: 60px;

        }
        table{
            border: 0px gainsboro;
            border-collapse: collapse;
            margin: 0px auto;
            width: 875px;
            position: relative;
        }
        #a1{
            width: 40px;
            height: 20px;
            text-align: center;
        }
        img{
            width: 60px;
            height: 60px;
        }
        #a2{
            width: 80px;
            height: 70px;
            text-align: center;

        }
        #a3{
            width: 150px;
            height: 50px;
            text-align: center;
        }
        #a4{
            width: 550px;
            text-align: center;

        }
        #a5{
            width: 150px;
            text-align: center;
        }
        #a6{
            width: 50px;
            height: 60px;
            text-align: center;
        }
        #a7{
            width: 100px;
            text-align: center;
            color: #00e689;
        }
        #box{
            background-color: white;
            position: relative;
            top: -22px;
            height: 200px;

        }
        #tj{
            width: 70px;
            height: 30px;
            text-align: center;
            line-height: 30px;
            display: inline-block;
            margin-left: 10px;
            background-color: #00cc9c;
            color: white;
            border-radius: 3px 3px 3px 3px;
            font-size: 12px;
            position: relative;
            left: 15px;
            bottom: 15px;
        }
        form{
            display: inline-block;
        }
        .n1 {
            width: 70px;
            height: 30px;
            text-align: center;
            line-height: 30px;
            background-color: #00cc9c;
            color: white;
            border-radius: 3px 3px 3px 3px;
            font-size: 12px;
            display: inline-block;
            border: 0px;
        }
        #a8{
            width: 100px;
            height: 30px;
            text-align: center;

        }
        .t1{
            width: 30px;
            height: 30px;
            display: inline-block;
        }
        #box2{

            background-color: white;
            position: relative;
            top: 40px;

        }
        a{
            text-decoration: none;
        }
        .action .t{
            height:41px;
            background:url(${path}/images/backIndex/right_bg.gif) no-repeat;
            font:14px 宋体; padding:10px 0 0 30px;
        }

    </style>
</head>
<body>
<div class="action  divaction">
    <div class="t">
        影院详细
    </div>
    <div id="box">
        <div id="box2">
        <div id="tj"><a href="${path}/jsp/cinemaAdd.jsp">添加</a></div>
<table border="1" style="width: 1070px;">
    <tr>
        <th>图片</th>
        <th>名称</th>
        <th>详细地址</th>
        <th>电话</th>
        <th>评分</th>
        <th style="width: 200px">添加时间</th>
        <th>操作</th>
    </tr>
    <c:set var="cinemaList" value="${requestScope.cinemaList}"/>
    <c:set var="pages" value="${sessionScope.pages}"/>
    <c:set var="path" value="${pageContext.request.contextPath }"/>
    <c:choose>
        <c:when test="${empty cinemaList ||empty pages}">
            <script>
                window.location="${path}/CinemaServlet?prom=showAll";

            </script>
        </c:when>

        <c:otherwise>
            <c:forEach var="cm" items="${cinemaList}">
                <tr id="${cm.cinema_id}" >
                    <td id="a2"><img src="${path}/images/cinemaPicture/${cm.cinema_img}"></td><%--影院头像 --%>
                    <td id="a3">${cm.cinema_name}</td> <%-- 影院名字--%>
                    <td id="a4">${cm.cinema_address}</td><%-- 影院地址--%>
                    <td id="a5">${cm.cinema_phone}</td><%--影院联系电话--%>
                    <td id="a6">${cm.cinema_score}</td> <%--影院评分--%>
                    <td id="a7">${cm.cinema_time}</td> <%--影院添加时间--%>
                    <td id="a8">
                       <img src="${path}/images/tool/xiugai.jpg" onclick="updateCine(${cm.cinema_id})" class="t1">
                       <img src="${path}/images/tool/shanchu.jpg" onclick="delInfo(${cm.cinema_id})" class="t1">
                    </td>
                </tr>
            </c:forEach>
        </c:otherwise>
    </c:choose>
    <tr style="height: 50px;">
        <th colspan="10" align="center">
            <p style="display: inline-block;">当前页数：[${pages.currPageNo}/${pages.totalPageCount}]
                <c:if test="${sessionScope.pages.currPageNo>1}">
            <form method="post" action="${path}/CinemaServlet?prom=showAll&pageIndex=1">
                <input type="submit" value="首页" class="n1">
            </form>
            <form method="post" action="${path}/CinemaServlet?prom=showAll&pageIndex=${pages.currPageNo-1}&cinema_name=${sessionScope.cinema_name}">
                <input type="submit" value="上一页" class="n1" >
            </form>
            </c:if>
            <c:if test="${sessionScope.pages.currPageNo<sessionScope.pages.totalPageCount}">
                <form method="post" action="${path}/CinemaServlet?prom=showAll&pageIndex=${pages.currPageNo+1}&cinema_name=${sessionScope.cinema_name}">
                    <input type="submit" value="下一页" class="n1">
                </form>
                <form method="post" action="${path}/CinemaServlet?prom=showAll&pageIndex=${pages.totalPageCount}&cinema_name =${sessionScope.cinema_name}">
                    <input type="submit" value="末页" class="n1">
                </form>
            </c:if>
            </p>
        </th>
    </tr>
    <script>
        function delInfo(id) {
            var choice=confirm("确认删除吗?");
            if (choice){
                $.post("${path}/CinemaServlet?prom=delId","cinema_id="+id,function (result) {
                    if (result>0){
                        alert("删除成功");
                        $("#"+id).remove();
                    }else {
                        alert("删除失败")
                    }
                },"text")
            }
        }
        function updateCine(cinema_id) {
            window.location="${path}/updateCineServlet?prom=selCine&cinema_id="+cinema_id
        }
    </script>
</table>
        </div>
    </div>
</div>

</body>
</html>
